import axios from './axios'

export function getAgents(options) {
  let params = {}
  if (!options) {
    params.page = 1
    params.size = 9999999
  } else {
    params = options
  }
  return axios.get('/api/v1/agents', {
    params,
    abort: true
  }).catch(err => {
    const msg = err.message
    return {
      success: false,
      message: msg,
      msg: msg,
      data: []
    }
  })
}

export function getRechargeTemplates(options) {
  let params = {}
  if (!options) {
    params.page = 1
    params.size = 9999999
  } else {
    params = options
  }
  return axios.get('/api/v1/sms/recharge/templates', {
    params: params,
    abort: true
  }).catch(err => {
    const msg = err.message
    return {
      success: false,
      message: msg,
      msg: msg,
      data: []
    }
  })
}